#include <iostream>
using namespace std;

int n, m, count = 0, ord, i, arr[101]; 

int main()
{
    scanf("%d%d", &n, &m);
    while (count != n)
    {
        for (i = 0; i < m; i++)
        {
            if (arr[(++ord)%n]) i--;
        }
        ord %= n;
        arr[ord] = 1;
        printf("%d ", ord==0? n:ord);
        count++;
    }
    return 0;
}